package Test2;

import java.util.Scanner;

public class Test {
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		boolean flag=true;
		while(flag){
			System.out.println("这是宠物列表：\n1.狗\n2.猫");
			System.out.print("请选择宠物：");
			int choice =scanner.nextInt();
			switch (choice) {
			case 1:
				Dog dog = new Dog();
				System.out.print("请输入狗狗昵称：");
				dog.setName(scanner.next());
				System.out.print("请输入狗狗性别(1.雄\t2.雌)：");
				int sexInt=scanner.nextInt();
				dog.setSex(sexInt==1?"雄":"雌");
				System.out.print("请输入狗狗健康值(有效健康值在1-100之间)：");
				dog.setHealth(scanner.nextInt());
				System.out.print("请输入狗狗与主人亲密度(有效亲密度在1-10之间)：");
				dog.setLove(scanner.nextInt());
				dog.show();
				flag=false;
				break;
			case 2:
				Cat cat = new Cat();
				System.out.print("请输入猫咪昵称：");
				cat.setName(scanner.next());
				System.out.print("请输入猫咪性别(1.雄\t2.雌)：");
				int sexInt1=scanner.nextInt();
				cat.setSex(sexInt1==1?"雄":"雌");
				System.out.print("请输入猫咪健康值(有效健康值在1-100之间)：");
				cat.setHealth(scanner.nextInt());
				System.out.print("请输入猫咪的慵懒度(有慵懒度在1-10之间)：");
				cat.setLazy(scanner.nextInt());
				cat.show();
				flag=false;
				break;
			default:
				System.out.println("输入无效，请重新输入！");
				break;
			}
		}
	}
}
